package sample.gui;

import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JSlider;
import javax.swing.JSpinner;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.JToggleButton;
import javax.swing.SpinnerListModel;


public class SimpleUIForTest extends JFrame {

	private static final long serialVersionUID = 1L;
	public static void main(String args[]) {
		new SimpleUIForTest();
	}
	SimpleUIForTest() {
		
		Container container = getContentPane();
		container.setLayout(new FlowLayout());
		
		JLabel jlbHelloWorld = new JLabel("Name");
		final JTextField jtextfield = new JTextField("N/A", 3);
		JButton jbutton = new JButton("Submit");
		
		String[] petStrings = { "Bird", "Cat", "Dog", "Rabbit", "Pig" };
		final JComboBox petList = new JComboBox(petStrings);
		petList.setSelectedIndex(4);
		
		JCheckBox chinButton = new JCheckBox("Chin");
		
		DefaultListModel listModel = new DefaultListModel();
        listModel.addElement("Jane Doe");
        listModel.addElement("John Smith");
        listModel.addElement("Kathy Green");
        //Create the list and put it in a scroll pane.
        JList list = new JList(listModel);
        
        JPasswordField passwordField = new JPasswordField(10);
		
        JRadioButton radioButton = new JRadioButton("Dog button");
        
        JSlider framesPerSecond = new JSlider(JSlider.HORIZONTAL,
                15, 30, 15);
        
        String[] labels = {"Month: ", "Year: ", "Another Date: "};
        SpinnerListModel monthModel = new SpinnerListModel(labels);
        JSpinner spinner = new JSpinner(monthModel);
        
        JToggleButton jtb = new JToggleButton("ToggleButton");
        
        JTabbedPane tabbedPane = new JTabbedPane();
        JComponent panel1 = new JButton("Panel #1");
        tabbedPane.addTab("Tab 1", null, panel1,
                          "Does nothing");
        JComponent panel2 = new JCheckBox("Panel #2");
        tabbedPane.addTab("Tab 2", null, panel2,
                          "Does nothing");
        
        
		add(jlbHelloWorld);
		add(jtextfield);
		add(petList);
		add(chinButton);
		add(list);
		add(passwordField);
		add(radioButton);
		add(framesPerSecond);
		add(spinner);
		add(jtb);
		add(tabbedPane);
		add(jbutton);
		
		this.setSize(900, 300);
		// pack();
		setVisible(true);
		
		jbutton.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				System.out.println("action-performed-ends");
			}
			
		});
		
		this.addWindowListener(new WindowAdapter() {

			public void windowClosing(WindowEvent e) {
				System.exit(0);
			}
		});
	}
	
	
}